//
//  SimpleDynamicCellConstraintFactory.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 16/12/10.
//  Copyright © 2016年 com.xtion.crm. All rights reserved.
//

#import "SimpleDynamicCellConstraintFactory.h"
#import "ExpandInfo.h"

@implementation SimpleDynamicCellConstraintFactory

+(XMSQueueDictionary*)factoryForModify:(ExpandInfo*)expandInfo
{
    return [[SimpleDynamicCellConstraintFactory new] factoryForModify:expandInfo];
}

+(XMSQueueDictionary*)factoryForReview:(ExpandInfo*)expandInfo
{
    return [[SimpleDynamicCellConstraintFactory new] factoryForReview:expandInfo];
}

-(XMSQueueDictionary*)originConstraint
{
    XMSQueueDictionary *tmp = [XMSQueueDictionary new];
    
    [tmp addKey:@"基本控件" value:[NSMutableArray arrayWithObjects:
                               [self smallText],[self bigText],
                               [self singleText],[self multiText],
                               [self intText],[self decimalText],
                               [self dateText],[self dateTimeText],
                               [self positionText],nil]];
    
    [tmp addKey:@"高级控件" value:[NSMutableArray arrayWithObjects:
                               [self headImageText],[self imagePanelText],[self singleSwitchText], [self mixedPanelText], nil]];
    
    return tmp;
}

-(XMSQueueDictionary*)factoryForModify:(ExpandInfo*)expandInfo
{
    return [self factoryForModify:expandInfo originConstraint:[self originConstraint]];
}

-(XMSQueueDictionary*)factoryForReview:(ExpandInfo*)expandInfo
{
    return [self factoryForReview:expandInfo originConstraint:[self originConstraint]];
}


-(FieldDescript*)smallText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeText];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"文本";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:1000];
    fix.fieldName = @"smallText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:0];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)bigText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeBigText];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"大文本";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:1000];
    fix.fieldName = @"bigText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:1];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)singleText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeSingleSelect];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"单选";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"singleText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"选择1,选择2";
    fix.order = [XMSNumberInt numberIntWithIntValue:2];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)multiText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeMultiSelect];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"多选";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"multiText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"多选1,多选2";
    fix.order = [XMSNumberInt numberIntWithIntValue:3];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)intText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeInt];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"整数";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"intText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:4];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)decimalText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeDecimal];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"实数";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"decimalText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:5];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)dateText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeDate];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"日期";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"dateText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:6];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)dateTimeText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeDateTime];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"时间";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"dateTimeText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:7];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}


-(FieldDescript*)positionText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypePosition];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"地址";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"positionText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:8];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)headImageText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeHeadImage];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"";
    fix.fieldLength = nil;
    fix.fieldName = @"headImageText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeDefault];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:9];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)imagePanelText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeImagePanel];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"";
    fix.fieldLength = nil;
    fix.fieldName = @"imagePanelText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeDefault];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:10];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)singleSwitchText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeSwitchSelect];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"点击跳转";
    fix.fieldLength = [XMSNumberInt numberIntWithIntValue:13];
    fix.fieldName = @"singleSwitchText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeCustom];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:2];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

-(FieldDescript*)mixedPanelText
{
    FieldDescript *fix = [FieldDescript new];
    fix.controlType = [XMSNumberInt numberIntWithIntValue:DynamicFieldControlTypeMixedPanel];
    fix.entityRegID = @"";
    fix.expandFieldID = @"";
    fix.fieldLabel = @"";
    fix.fieldLength = nil;
    fix.fieldName = @"mixedPanelText";
    fix.fieldType = [XMSNumberInt numberIntWithIntValue:DynamicFieldTypeDefault];
    fix.isAllowEmpty = [XMSNumberInt numberIntWithIntValue:1];
    fix.isReadOnly = [XMSNumberInt numberIntWithIntValue:0];
    fix.optional = @"";
    fix.order = [XMSNumberInt numberIntWithIntValue:10];
    fix.regx = @"";
    fix.status = nil;
    fix.optIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    fix.viewIsVisible = [XMSNumberInt numberIntWithIntValue:1];
    return fix;
}

@end
